package org.csu.mypetstorems.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import lombok.Data;

@Data
@TableName("admin")
public class Admin {
    @TableId(value = "id",type = IdType.AUTO)
    private Long id;

    @Pattern(regexp = "^.{1,10}$", message = "用户名格式不正确")
    @NotEmpty(message = "用户名不能为空")
    private String username;

    private String password;

    @NotEmpty(message = "姓名不能为空")
    @Pattern(regexp = "^.{1,10}$", message = "名字格式不正确")
    private String name;

    @NotEmpty(message = "性别不能为空")
    private String sex;

    @NotEmpty(message = "电话号码不能为空")
    @Pattern(regexp = "^1[3-9]\\d{9}$", message = "电话号码格式不正确")
    private String phone;

    @NotNull(message = "状态不能为空")
    private int status;
}
